package View;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JLabel;

public class DrawBubble extends JComponent {
    
    private ArrayList<Bubble> myBubbles;
    private static DrawBubble myDrawBubble;
    
    private DrawBubble(){
        myBubbles=new ArrayList<Bubble> ();
        makeBubble(100.0f,100.0f,100.0f);
        
    }
    
public static DrawBubble getDrawBubble(){
    
    if(myDrawBubble==null){
        return new DrawBubble();
        
    }else{
        return myDrawBubble;
    }
    
}

public void clickBubble(double x, double y){
    
    for(Bubble b:myBubbles){
        
        b.isClicked(x, y);
        
    }
    
}
    
    public void paint(Graphics g) {
        // Retrieve the graphics context; this object is used to paint shapes
        Graphics2D g2d = (Graphics2D)g;
        for(Bubble circle: myBubbles){
        circle.draw(g2d);
        
        }
       
    }
    /**
     * calculate the position and color of the bubble
     */
    public void calculateBubble(){
        
    }
    
    private void makeBubble(double x, double y, double radius){
        Bubble b=new Bubble(x,y,radius);
        myBubbles.add(b);
      
        
        
    }

}
